package com.hcy.schedulingapi.controller;

import com.hcy.rabbitbasicmodel.model.ReturnResult;
import com.hcy.rabbitbasicutils.utils.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author huchenying
 * @Description
 * @Date 2022/1/12 21:46
 */
@RestController
@RequestMapping("/redis")
public class DemoController {

    @Autowired
    RedisUtils redisUtils;

    @GetMapping("/setKey")
    public ReturnResult setKey(){
        redisUtils.set("key1","value1");
        return ReturnResult.success("设置成功！");
    }
    @GetMapping("/getKey")
    public ReturnResult getKey(){
        String key1 = redisUtils.get("key1");
        return ReturnResult.success("设置成功！").setData("result -> " + key1);
    }
}
